﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MethodParameter_ExtensionMethod
{
  public class WordProcessor
  {
    public static List<string> GetWords(string words, 
                                        bool toUpperCase = false, 
                                        bool reverseOrder = false)
    {
      List<String> result = new List<string>();
      foreach (string word in words.Split(new char[]{' '},StringSplitOptions.RemoveEmptyEntries))
      {
        string w;
        if (toUpperCase)
          w = word.ToUpper();
        else
          w = word;
        if (reverseOrder)
          result.Insert(0, w);
        else
          result.Add(w);       
      }
      return result;
    }
  }
}
